import _ from 'lodash'
import dayjs from 'dayjs'

import './bar_01'
import './bar_02'

console.log('index.js')
console.log(_.join(['Hello', 'Index']))
console.log(dayjs(), 'index')

const button = document.createElement('button')
button.innerHTML = '加载元素'
// Prefetch
// Preload
button.addEventListener('click', () => {
  // prefetch -> 魔法注释(magin comments)
  import(
    /* webpackChunkName: 'element' */
    /* webpackPrefetch: true */
    './element'
  ).then(({default: element}) => {
    document.body.appendChild(element)
  })
})
document.body.appendChild(button)
